package com.paypal.android.MEP;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.Editable;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.ScaleAnimation;
import android.widget.EditText;
import com.paypal.android.MEP.a.a;
import com.paypal.android.MEP.a.d;
import com.paypal.android.MEP.a.g;
import com.paypal.android.MEP.a.k;
import com.paypal.android.MEP.a.q;
import com.paypal.android.a.j;
import java.util.Hashtable;
import java.util.Vector;

public final class PayPalActivity extends Activity
  implements Animation.AnimationListener
{
  public static com.paypal.android.a.c a = null;
  public static e b;
  public static String d;
  public static String e;
  public static String f;
  public static String g;
  public static String h;
  public static String i;
  public static String j;
  public static String k;
  public static String l;
  public static String m;
  private static PayPalActivity p = null;
  private static String u = null;
  public boolean c = false;
  private o n;
  private n o;
  private Vector q;
  private Animation r;
  private Intent s = null;
  private boolean t = false;
  private BroadcastReceiver v = new t(this);
  private BroadcastReceiver w = new s(this);

  public static PayPalActivity a()
  {
    return p;
  }

  private boolean a(int paramInt)
  {
    Object localObject;
    if (paramInt == 0)
    {
      com.paypal.android.a.c.f().b("mpl-login");
      localObject = new g(this);
      if (this.q.size() <= 0)
        break label296;
    }
    label296: for (com.paypal.android.b.n localn = (com.paypal.android.b.n)this.q.lastElement(); ; localn = null)
    {
      setContentView((View)localObject);
      this.q.add(localObject);
      if (localn != null)
        localn.e();
      if (paramInt == 0)
      {
        ScaleAnimation localScaleAnimation = new ScaleAnimation(0.0F, 1.0F, 0.0F, 1.0F, 2, 0.5F, 2, 0.5F);
        localScaleAnimation.setDuration(500L);
        localScaleAnimation.setRepeatCount(0);
        localScaleAnimation.setAnimationListener(this);
        ((com.paypal.android.b.n)localObject).setAnimation(localScaleAnimation);
        if (u != null)
        {
          ((g)localObject).a(com.paypal.android.MEP.a.i.d);
          ((g)localObject).a(u);
          u = null;
        }
      }
      return true;
      if (paramInt == 1)
      {
        com.paypal.android.a.c.f().b("mpl-help-binding");
        localObject = new d(this);
        break;
      }
      if (paramInt == 2)
      {
        com.paypal.android.a.c.f().b("mpl-help");
        localObject = new com.paypal.android.MEP.a.n(this);
        break;
      }
      if (paramInt == 3)
      {
        localObject = new a(this);
        break;
      }
      if (paramInt == 4)
      {
        localObject = new q(this);
        break;
      }
      if (paramInt == 5)
      {
        localObject = new com.paypal.android.MEP.a.e(this, this.s);
        break;
      }
      if (paramInt == 6)
      {
        localObject = new com.paypal.android.MEP.a.o(this);
        break;
      }
      if (paramInt == 7)
      {
        com.paypal.android.a.c.f().b("mpl-create-PIN");
        localObject = new k(this);
        break;
      }
      return false;
    }
  }

  private void d()
  {
    String str = e.a().f();
    j = str + "PUSH_DIALOG_";
    k = str + "POP_DIALOG";
    l = str + "REPLACE_DIALOG_";
    m = str + "UPDATE_VIEW";
    d = str + "LOGIN_SUCCESS";
    f = str + "LOGIN_FAIL";
    e = str + "AUTH_SUCCESS";
    g = str + "CREATE_PAYMENT_SUCCESS";
    h = str + "CREATE_PAYMENT_FAIL";
    i = str + "FATAL_ERROR";
    IntentFilter localIntentFilter1 = new IntentFilter();
    localIntentFilter1.addAction(k);
    for (int i1 = 0; i1 < 9; i1++)
    {
      localIntentFilter1.addAction(j + i1);
      localIntentFilter1.addAction(l + i1);
    }
    localIntentFilter1.addAction(m);
    registerReceiver(this.w, localIntentFilter1);
    IntentFilter localIntentFilter2 = new IntentFilter();
    localIntentFilter2.addAction(d);
    localIntentFilter2.addAction(f);
    localIntentFilter2.addAction(g);
    localIntentFilter2.addAction(h);
    localIntentFilter2.addAction(i);
    registerReceiver(this.v, localIntentFilter2);
    com.paypal.android.a.c.d();
  }

  private void e()
  {
    if ((this.q != null) && (this.q.size() > 0))
    {
      com.paypal.android.b.n localn = (com.paypal.android.b.n)this.q.lastElement();
      this.r = new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F, 2, 0.5F, 2, 0.5F);
      this.r.setDuration(500L);
      this.r.setRepeatCount(0);
      this.r.setAnimationListener(this);
      localn.setAnimation(this.r);
      runOnUiThread(new com.paypal.android.b.p(localn, this.r));
      return;
    }
    finish();
    p = null;
  }

  public final Vector a(b paramb, String paramString, Vector paramVector)
  {
    if (this.n != null)
      return this.n.a(paramb, paramString, paramVector);
    return null;
  }

  public final void a(String paramString1, String paramString2)
  {
    Intent localIntent = new Intent();
    localIntent.putExtra("com.paypal.android.PAY_KEY", paramString1);
    localIntent.putExtra("com.paypal.android.PAYMENT_STATUS", paramString2);
    setResult(-1, localIntent);
    e();
  }

  public final void a(String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean1, boolean paramBoolean2)
  {
    if (this.c)
      a((String)com.paypal.android.a.c.f().d("PayKey"), (String)com.paypal.android.a.c.f().d("PaymentExecStatus"));
    do
    {
      return;
      if ((this.o != null) && (paramBoolean2))
        this.o.a("OTHER", paramString1, paramString2, paramString3, paramString4);
    }
    while (!paramBoolean1);
    Intent localIntent = new Intent();
    localIntent.putExtra("com.paypal.android.CORRELATION_ID", paramString1);
    localIntent.putExtra("com.paypal.android.PAY_KEY", paramString2);
    localIntent.putExtra("com.paypal.android.ERROR_ID", paramString3);
    localIntent.putExtra("com.paypal.android.ERROR_MESSAGE", paramString4);
    localIntent.putExtra("com.paypal.android.PAYMENT_STATUS", "OTHER");
    setResult(2, localIntent);
    e();
  }

  public final void a(String paramString1, String paramString2, boolean paramBoolean)
  {
    if (this.o != null)
      this.o.a(paramString1, paramString2);
    if (paramBoolean)
      a(paramString1, paramString2);
  }

  public final void a(boolean paramBoolean)
  {
    this.c = paramBoolean;
  }

  public final void b()
  {
    if (this.c)
    {
      a((String)com.paypal.android.a.c.f().d("PayKey"), (String)com.paypal.android.a.c.f().d("PaymentExecStatus"));
      return;
    }
    if (this.o != null)
      this.o.a("OTHER");
    Intent localIntent = new Intent();
    localIntent.putExtra("com.paypal.android.PAYMENT_STATUS", "OTHER");
    setResult(0, localIntent);
    e();
  }

  public final void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    if (paramInt1 == 3)
    {
      setResult(paramInt2, paramIntent);
      e();
    }
  }

  public final void onAnimationEnd(Animation paramAnimation)
  {
    if (paramAnimation == this.r)
    {
      p.finish();
      p = null;
    }
  }

  public final void onAnimationRepeat(Animation paramAnimation)
  {
  }

  public final void onAnimationStart(Animation paramAnimation)
  {
  }

  protected final void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.t = false;
    Hashtable localHashtable = (Hashtable)getLastNonConfigurationInstance();
    int i1;
    Object localObject1;
    int i2;
    Object localObject2;
    if (localHashtable != null)
    {
      b = (e)localHashtable.get("PayPal");
      Vector localVector = (Vector)localHashtable.get("ViewStack");
      this.q = new Vector(0);
      a = (com.paypal.android.a.c)localHashtable.get("NetworkHandler");
      if (localHashtable.get("ReviewViewInfo") != null)
        a.a = (Hashtable)localHashtable.get("ReviewViewInfo");
      d();
      i1 = 0;
      localObject1 = null;
      if (i1 < localVector.size())
      {
        i2 = ((Integer)localVector.elementAt(i1)).intValue();
        if (i2 == 0)
          localObject2 = new g(this);
      }
    }
    while (true)
    {
      this.q.add(localObject2);
      i1++;
      localObject1 = localObject2;
      break;
      if (i2 == 1)
      {
        localObject2 = new d(this);
      }
      else if (i2 == 2)
      {
        localObject2 = new com.paypal.android.MEP.a.n(this);
      }
      else if (i2 == 3)
      {
        localObject2 = new a(this);
      }
      else if (i2 == 4)
      {
        localObject2 = new q(this);
      }
      else if (i2 == 5)
      {
        localObject2 = new com.paypal.android.MEP.a.e(this);
      }
      else if (i2 == 6)
      {
        localObject2 = new com.paypal.android.MEP.a.o(this);
      }
      else if (i2 == 7)
      {
        localObject2 = new k(this);
        continue;
        Editable localEditable1 = (Editable)localHashtable.get("UserString");
        EditText localEditText1 = (EditText)findViewById(5004);
        if ((localEditText1 != null) && (localEditable1 != null) && (localEditable1.length() > 0))
          localEditText1.setText(localEditable1);
        Editable localEditable2 = (Editable)localHashtable.get("PasswordString");
        EditText localEditText2 = (EditText)findViewById(5005);
        if ((localEditText2 != null) && (localEditable2 != null) && (localEditable2.length() > 0))
          localEditText2.setText(localEditable2);
        setContentView((View)this.q.lastElement());
        this.q.lastElement();
        p = this;
        return;
        Intent localIntent = getIntent();
        if ((!localIntent.hasExtra("com.paypal.android.PAYPAL_PAYMENT")) && (!localIntent.hasExtra("com.paypal.android.PAYPAL_PREAPPROVAL")))
          throw new NullPointerException("PayPalPayment/Preapproval object does not exist in intent");
        if (localIntent.hasExtra("com.paypal.android.PAYMENT_ADJUSTER"))
          this.n = ((o)localIntent.getSerializableExtra("com.paypal.android.PAYMENT_ADJUSTER"));
        if (localIntent.hasExtra("com.paypal.android.RESULT_DELEGATE"))
          this.o = ((n)localIntent.getSerializableExtra("com.paypal.android.RESULT_DELEGATE"));
        d();
        e locale = e.a();
        if (locale.A() == 3)
        {
          l locall = (l)localIntent.getSerializableExtra("com.paypal.android.PAYPAL_PREAPPROVAL");
          if (locall == null)
          {
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_no_payment"), true, true);
            return;
          }
          if ((!locall.e()) || (locale.g() == null) || (locale.g().length() <= 0))
          {
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_invalid_payment"), true, true);
            return;
          }
          if (!com.paypal.android.a.c.b())
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_application_not_authorized"), true, true);
        }
        else
        {
          h localh = (h)localIntent.getSerializableExtra("com.paypal.android.PAYPAL_PAYMENT");
          if (localh == null)
          {
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_no_payment"), true, true);
            return;
          }
          if (!localh.e())
          {
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_invalid_payment"), true, true);
            return;
          }
          if (!com.paypal.android.a.c.b())
          {
            a((String)com.paypal.android.a.c.f().d("CorrelationId"), (String)com.paypal.android.a.c.f().d("PayKey"), "-1", j.a("ANDROID_application_not_authorized"), true, true);
            return;
          }
        }
        p = this;
        if (this.q != null)
          this.q.setSize(0);
        while (true)
        {
          com.paypal.android.MEP.a.h.a(0);
          return;
          this.q = new Vector(0);
        }
      }
      else
      {
        localObject2 = localObject1;
      }
    }
  }

  protected final void onDestroy()
  {
    super.onDestroy();
    try
    {
      unregisterReceiver(this.w);
      unregisterReceiver(this.v);
      return;
    }
    catch (Exception localException)
    {
    }
  }

  public final boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
    {
      if ((this.q.lastElement() instanceof g))
      {
        if (((g)this.q.lastElement()).b() != com.paypal.android.MEP.a.i.b)
          new com.paypal.android.MEP.b.i(this).show();
        return true;
      }
      if ((this.q.lastElement() instanceof a))
      {
        if ((((a)this.q.lastElement()).b() != com.paypal.android.MEP.a.c.b) && (((a)this.q.lastElement()).b() != com.paypal.android.MEP.a.c.d))
          new com.paypal.android.MEP.b.i(this).show();
        return true;
      }
      if ((this.q.lastElement() instanceof com.paypal.android.MEP.a.o))
      {
        if (((com.paypal.android.MEP.a.o)this.q.lastElement()).b() != com.paypal.android.MEP.a.p.c)
          new com.paypal.android.MEP.b.i(this).show();
        return true;
      }
      if (((this.q.lastElement() instanceof com.paypal.android.MEP.a.n)) || ((this.q.lastElement() instanceof d)))
      {
        com.paypal.android.MEP.a.h.a();
        return true;
      }
      if (((this.q.lastElement() instanceof q)) || ((this.q.lastElement() instanceof k)))
      {
        if (!this.t)
        {
          this.t = true;
          a((String)a.d("PayKey"), (String)a.d("PaymentExecStatus"), true);
        }
        return true;
      }
      return super.onKeyDown(paramInt, paramKeyEvent);
    }
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  public final Object onRetainNonConfigurationInstance()
  {
    Hashtable localHashtable = new Hashtable();
    localHashtable.put("PayPal", b);
    Vector localVector = new Vector();
    int i1 = 0;
    com.paypal.android.b.n localn;
    int i2;
    if (i1 < this.q.size())
    {
      localn = (com.paypal.android.b.n)this.q.elementAt(i1);
      if ((localn instanceof g))
        i2 = 0;
    }
    while (true)
    {
      localVector.add(new Integer(i2));
      i1++;
      break;
      if ((localn instanceof d))
      {
        i2 = 1;
      }
      else if ((localn instanceof com.paypal.android.MEP.a.n))
      {
        i2 = 2;
      }
      else if ((localn instanceof a))
      {
        i2 = 3;
      }
      else if ((localn instanceof q))
      {
        i2 = 4;
      }
      else if ((localn instanceof com.paypal.android.MEP.a.e))
      {
        i2 = 5;
      }
      else if ((localn instanceof com.paypal.android.MEP.a.o))
      {
        i2 = 6;
      }
      else if ((localn instanceof k))
      {
        i2 = 7;
        continue;
        localHashtable.put("ViewStack", localVector);
        localHashtable.put("NetworkHandler", a);
        if (a.a != null)
          localHashtable.put("ReviewViewInfo", a.a);
        EditText localEditText1 = (EditText)findViewById(5004);
        if (localEditText1 != null)
        {
          Editable localEditable2 = localEditText1.getText();
          if ((localEditable2 != null) && (localEditable2.length() > 0))
            localHashtable.put("UserString", localEditable2);
        }
        EditText localEditText2 = (EditText)findViewById(5005);
        if (localEditText2 != null)
        {
          Editable localEditable1 = localEditText2.getText();
          if ((localEditable1 != null) && (localEditable1.length() > 0))
            localHashtable.put("PasswordString", localEditable1);
        }
        return localHashtable;
      }
      else
      {
        i2 = 0;
      }
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.paypal.android.MEP.PayPalActivity
 * JD-Core Version:    0.6.2
 */